﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowNow.aspx.cs" Inherits="iEN.Immediate.ShowNow" %>

<%@ Register src="../UserControl/TopMenu.ascx" tagname="TopMenu" tagprefix="uc2" %>

<%@ Register assembly="DundasWebGauge" namespace="Dundas.Gauges.WebControl" tagprefix="DGWC" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>即時狀態顯示</title>
    <script type="text/javascript">
        function EndRequestHandler(sender, args) {
            if (args.get_error() != undefined) {
                var code = args.get_response().get_statusCode(); // 0, 500, 503, 12007, 12029, 12031
                //alert('EndRequestHandler: ' + code);
                //clear error
                args.set_errorHandled(true);
                // alert('網路暫時無法連線，請重試！');   
            }
        }
        function init() {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            Sys.Application.add_load(
            function () {
                var form = Sys.WebForms.PageRequestManager.getInstance()._form;
                form._initialAction = form.action = window.location.href;
            }
            );
        }


    </script>
    <style type="text/css">
        #IMap
        {
            width: 952px
         }
    </style>
</head>
<body onload="init();">
    <form id="form1" runat="server">
    <uc2:TopMenu ID="TopMenu1" runat="server" />
        <center>
    <asp:ScriptManager ID="ScriptManager1" runat="server" />     
        <table>
            <tr>
                <td style="background-image:url('../images/title_back.gif')" align="center" ; width="952px" >
                    <asp:Label ID="Label1" runat="server" Text="即時狀態顯示" BackColor="Transparent" style="color:Blue;background-color:Transparent;font-family:標楷體;font-size:XX-Large;"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align=left>
                      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate >
                        <table class="un_visible">
                            <tr>
                                <td align="left" valign="top" class="style1">
                                    <!-- 組織群組樹狀圖區塊 -->
                                        <br />
                                        <asp:TreeView ID="tvMeterGrp" runat="server" ShowLines="True" 
                                            Height="300px" Width="200px" 
                                         onselectednodechanged="tvMeterGrp_SelectedNodeChanged">
                                        <LevelStyles>
                                            <asp:TreeNodeStyle CssClass="nodeLevel1" Font-Underline="False" ImageUrl="~/images/level01.gif"/>
                                            <asp:TreeNodeStyle CssClass="nodeLevel2" Font-Underline="False" ImageUrl="~/images/dot02.gif" />
                                            <asp:TreeNodeStyle CssClass="nodeLevel3" Font-Underline="False" ImageUrl="~/images/dot01.gif" />
                                            <asp:TreeNodeStyle CssClass="nodeLevel4" Font-Underline="False" ImageUrl="~/images/dot01.gif" />
                                            <asp:TreeNodeStyle CssClass="nodeLevelDev" Font-Underline="False" ImageUrl="~/images/rootcomp.gif" />
                                            <asp:TreeNodeStyle CssClass="nodeLevelLast" Font-Underline="False" ImageUrl="~/images/use_yes.gif"/>
                                        </LevelStyles>
                                            <HoverNodeStyle CssClass="node_hover" Font-Size="Large" />
                                            <NodeStyle ForeColor="Blue" Font-Names="微軟正黑體" />
                                            <SelectedNodeStyle ForeColor="Red" BackColor="#FFFF99" />
                                        </asp:TreeView>        
                                </td>
                                <asp:Label ID="lblNode" runat="server" Text="ShowNowRoom.aspx" Visible=false></asp:Label>
                                <td valign="top" align="center">
                                    <iframe id="iShowNow" src="" frameborder="0" width="780" hight="100%" 
                                        height="600" style="overflow-x: hidden">
                                    </iframe>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel> 
                </td>
            </tr>
        </table>
        </center>
</form>
<script language="javascript">
    var f = document.getElementById("iShowNow");
    if (getPage() == "") {
        f.src = "about:blank";
    }
    else {
        f.src = getPage() + "?ID=" + getID();
    }
    

    function getPage() {
        var queryString = window.location.search;
        // Add "=" to the parameter name (i.e. parameterName=value)
        var parameterName = "Page=";

        if (queryString.length > 0) {
            // Find the beginning of the string
            begin = queryString.indexOf(parameterName);
            // If the parameter name is not found, skip it, otherwise return the value
            if (begin != -1) {
                // Add the length (integer) to the beginning
                begin += parameterName.length;
                // Multiple parameters are separated by the "&" sign
                end = queryString.indexOf("&", begin);
                if (end == -1) {
                    end = queryString.length
                }
                // Return the string
                return unescape(queryString.substring(begin, end));
            }
            // Return "null" if no parameter has been found
            return "";
        }
        else {
            return "";
        }

    }

    
    function getID() {
        var queryString = window.location.search;
        // Add "=" to the parameter name (i.e. parameterName=value)
        var parameterName = "ID=";

        if (queryString.length > 0) {
            // Find the beginning of the string
            begin = queryString.indexOf(parameterName);
            // If the parameter name is not found, skip it, otherwise return the value
            if (begin != -1) {
                // Add the length (integer) to the beginning
                begin += parameterName.length;
                // Multiple parameters are separated by the "&" sign
                end = queryString.indexOf("&", begin);
                if (end == -1) {
                    end = queryString.length
                }
                // Return the string
                return unescape(queryString.substring(begin, end));
            }
            // Return "null" if no parameter has been found
            return "";
        }
        else {
            return "";
        }

    }
</script>
</body>
</html>